Skip to content

fix: use &[T] instead of &Vec<T> in function signatures#190

Merged
jczaja merged 1 commit intomainfrom
sfraczek/use-slices-instead-of-vec-refs
Apr 20, 2026
Merged

fix: use &[T] instead of &Vec<T> in function signatures#190
jczaja merged 1 commit intomainfrom
sfraczek/use-slices-instead-of-vec-refs

Conversation

@sfraczek
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the flexibility of internal transaction verification helpers by switching their parameters from &Vec<T> to slice references (&[T]), allowing callers to pass any contiguous collection (including Vec, arrays, and slices) without forcing a concrete Vec type.

Changes:

  • Updated verify_interests_transactions to accept &[(String, T, T)] instead of &Vec<(String, T, T)>.
  • Updated verify_dividends_transactions to accept &[(String, T, T, Option<String>)] instead of &Vec<...>.
  • Updated verify_transactions to accept &[(String, String, T, T, Option<String>)] instead of &Vec<...>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/transactions.rs

/// Check if all interests rate transactions come from the same year
pub fn verify_interests_transactions<T>(transactions: &Vec<(String, T, T)>) -> Result<(), String> {
pub fn verify_interests_transactions<T>(transactions: &[(String, T, T)]) -> Result<(), String> {
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title suggests a general move away from &Vec<T> in function signatures, but src/transactions.rs still contains public functions taking &Vec<...> (e.g., reconstruct_sold_transactions) and src/lib.rs has &Vec<...> params as well. Consider updating the remaining signatures to slices (&[...]) in this PR or adjusting the PR scope/title so the change is consistent and expectations are clear.

Copilot uses AI. Check for mistakes.
@sfraczek sfraczek requested a review from jczaja April 18, 2026 18:53
Copy link
Copy Markdown
Collaborator

@jczaja jczaja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! LGTM

@jczaja jczaja merged commit 26884af into main Apr 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants